package com.Arsanesia.TempleRush.Views.Screens;

import com.Arsanesia.TempleRush.TempleRush;
import com.Arsanesia.TempleRush.Controllers.Listeners.HighScoreListener;
import com.Arsanesia.TempleRush.Models.Profile;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;

public class HighScoreScreen extends AbstractScreen{
	private Profile profile;
	private Image highscoreimage;
	public HighScoreScreen(TempleRush game){
		super(game);
	}
	@Override
	public void show(){
		atlas = new TextureAtlas(Gdx.files.internal("Images/HighScore/highscore.atlas"));
		profile = game.getProfileManager().retrieveProfile();
		highscoreimage = new Image(new TextureRegionDrawable(new TextureRegion(atlas.createSprite("highscorescreen"))));
		//add listener
		highscoreimage.addListener(new HighScoreListener(game));
		//add to stage
		this.addActor(highscoreimage);
	}
	@Override
	public void resize(int width, int height) {
		super.resize(width, height);
	}
	@Override
	public void render(float delta){
		super.render(delta);
		this.getSpriteBatch().begin();
		font.draw(this.getSpriteBatch(), profile.getTotalTemple()+"", VIEWPORT_DEFAULTWIDTH/2, 5.5f*VIEWPORT_DEFAULTHEIGHT/7);
        font.draw(this.getSpriteBatch(), profile.getTempleBuilt()+"", VIEWPORT_DEFAULTWIDTH/2,4.7f*VIEWPORT_DEFAULTHEIGHT/7);
        font.draw(this.getSpriteBatch(), profile.getTotalScore()+"", VIEWPORT_DEFAULTWIDTH/2, 3.7f*VIEWPORT_DEFAULTHEIGHT/7);
		font.draw(this.getSpriteBatch(), profile.getHighScore()+"", VIEWPORT_DEFAULTWIDTH/2, 3*VIEWPORT_DEFAULTHEIGHT/7);
		this.getSpriteBatch().end(); 
		
	}
}
